package com.easy.service.impl;

import com.easy.bean.ServiceStylist;
import com.easy.mapper.ServiceStylistDao;
import com.easy.service.ServiceStylistService;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ServiceStylistServiceimpl implements ServiceStylistService {

    @Autowired
    ServiceStylistDao serviceStylistDao;

    @Override
    public ServiceStylist add(ServiceStylist serviceStylist) {
        //新增数据
        serviceStylistDao.add(serviceStylist);
        //通过主键查询数据库中的数据
        ServiceStylist result = serviceStylistDao.one(serviceStylist.getId());
        return result;
    }

    @Override
    public int del(Integer id) {
        return serviceStylistDao.del(id);
    }

    @Override
    public ServiceStylist edit(ServiceStylist serviceStylist) {
        serviceStylistDao.edit(serviceStylist);
        ServiceStylist result = serviceStylistDao.one(serviceStylist.getId());
        return result;
    }

    @Override
    public List<ServiceStylist> all(ServiceStylist serviceStylist) {
        return serviceStylistDao.all(serviceStylist);
    }

    @Override
    public ServiceStylist one(Integer id) {
        return serviceStylistDao.one(id);
    }

    @Override
    public void page(Page page, ServiceStylist serviceStylist) {
        int count = serviceStylistDao.pageCount(serviceStylist);
        Object data = serviceStylistDao.page(page, serviceStylist);
        page.setCount(count);
        page.setData(data);
    }


}
